<template>
    <div class="imgBox"  :style="{ '--afterWidth': props.progress_percent + '%' }">
        <img :src="props.cover" />
        <span v-if="!props.isUp" class="steping">{{ props.steping }}</span>
        <span v-else class="videoPlayInfo">
            <p>
                <img src="@/assets/videoCardIcon/play.png" />
                <span>{{ formatNum(props.playNum) }}</span>
            </p>
            <p>
                <img src="@/assets/videoCardIcon/barrage.png" />
                <span>{{ props.barNum?props.barNum:'-' }}</span>
            </p>
        </span>
        <span v-show="!props.isUp"></span>   <!-- 进度条 -->
        <span></span>   <!-- 阴影 -->
    </div>
    <div class="infoBox">
        <span>{{ props.title }}</span>
        <span><img src="@/assets/videoCardIcon/UP.png" v-if="props.isUp" />{{ props.lable }}</span>
    </div>
</template>

<script lang="ts" setup>
import { formatNum } from '@/utils/format'
interface Props{
    title:string,
    cover:string,
    lable:string,
    steping?:string,
    progress_percent?:number
    isUp?:boolean | false
    playNum?:number
    barNum?:number
}
const props = defineProps<Props>()

</script>

<style lang="scss" scoped>
@media  screen and (min-width: 0px) and (max-width: 1600px){
    .imgBox{
        height: 136px;
    }
}
@media  screen and (min-width: 1600px) and (max-width: 2000px){
    .imgBox{
        height: 150px;
    }
}
p{
    padding: 0;
    margin: 0;
}
.imgBox{
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 8px;
    & span:nth-child(3){
        position: absolute;
        border-radius: 30px;
        left: 5%;
        bottom: 7px;
        width: 90%;
        height: 3px;
        background-color: rgb(255, 255, 255,0.3);
        z-index: 2;
    }
    & span:nth-child(3)::after{
        content: "";
        position: absolute;
        border-radius: 30px;
        left: 0;
        bottom: 0;
        width: var(--afterWidth);
        height: 100%;
        background-color: white;
    }
    & span:nth-child(4){
        position: absolute;
        width: 100%;
        height: 50%;
        border-radius: 8px;
        background: linear-gradient(rgb(255, 255, 255,0) 1%,rgb(0, 0, 0,0.6));
        bottom: 0;
        left: 0;
        z-index: 1;
    }
}
.steping{
    position: absolute;
    color: white;
    font-size: 13px;
    bottom: 12px;
    left: 5%;
    z-index: 2;
}
.videoPlayInfo{
    position: absolute;
    z-index: 2;
    bottom: 5px;
    color: white;
    left: 0;
    display: flex;
    font-size: 13px;
    align-items: center;
    & p{
        height: 100%;
        @include flexRowCenter;
        padding: 0 5px;
    }
    & p img{
        width:18px;
        height:15px;
        padding-right: 1px;
        border-radius: 40px;
        color: white;
        margin-right: 5px;
    }
}
.infoBox{
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: start;
    & span:nth-child(1){
        color: #18191c;
        font-size: 15px;
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: left;
        cursor: pointer;
    }
    & span:nth-child(1):hover{
        color: #069cfae0;
    }
    & span:nth-child(2){
        color: rgba(0,0,0,.5);
        font-size: 13px;
        display: flex;
        align-items: center;
        cursor: pointer;
    }
    & span:nth-child(2) img{
        margin-right: 2px;
    }
    & span:nth-child(2):hover{
        color: #069cfae0;
    }
}
</style>